package summary;

/**
 * @Author: 海琳琦
 * @Date: 2022/3/9 21:50
 * https://leetcode-cn.com/problems/add-digits/
 */
public class Title258 {

    /**
     * @param num
     * @return
     */
    public static int addDigits(int num) {
        //单独考虑0的情况
        if (num == 0) {
            return 0;
        }
        if (num % 9 == 0) {
            return 9;
        }
        return num % 9;
    }

    public static void main(String[] args) {
        int i = addDigits(38);

    }
}
